<?php declare(strict_types=1);


namespace Database\Migration;


use Swoft\Db\Schema\Blueprint;
use Swoft\Devtool\Annotation\Mapping\Migration;
use Swoft\Devtool\Migration\Migration as BaseMigration;

/**
 * Class OganizationPosition
 *
 * @since 2.0
 *
 * @Migration(time=20200430143554)
 */
class OganizationPosition extends BaseMigration
{
    /**
     * @return void
     */
    public function up(): void
    {
        //开始编写
        $this->schema->createIfNotExists('organization_position', function (Blueprint $blueprint){
            $blueprint->comment('组织职位表');

            $blueprint->increments('id')->comment('主键id');
            $blueprint->string('item_id', 32)->index('item_id_index')->comment('数据唯一ID');
            //开始自己数据字段
            $blueprint->string('organization_id', 32)->comment('组织id');
            $blueprint->string('position_id', 32)->comment('职位id');
            //结束自己数据字段
            $blueprint->engine = 'Innodb';
            $blueprint->charset = 'utf8mb4';
        });
    }

    /**
     * @return void
     */
    public function down(): void
    {
        $this->schema->dropIfExists('organization_position');
    }
}
